package com.liveinstars.activity.business.clockin.repository.persistence;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liveinstars.activity.business.clockin.repository.mapper.ClockinMapper;
import com.liveinstars.activity.business.clockin.repository.facade.IClockinService;
import com.liveinstars.activity.business.clockin.repository.po.Clockin;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 活动打卡表 服务实现类
 * </p>
 *
 * @author ting
 * @since 2020-08-24
 */
@Service
public class ClockinServiceImpl extends ServiceImpl<ClockinMapper, Clockin> implements IClockinService {

    @Override
    public Clockin getMyClockIn(Integer userId, Integer activityId) {
        QueryWrapper<Clockin> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("activity_id", activityId);
        queryWrapper.eq("user_id", userId);
        Clockin clockin = this.getOne(queryWrapper, false);
        return clockin;
    }
}
